package com.example.demo.util.ljming;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CombinationGenerator {

    public static void main(String[] args) {
        List<String> group1 = Arrays.asList("如何", "怎样", "有什么办法", "有什么方法", "用什么手段", "用什么措施");
        List<String> group2 = Arrays.asList("删除", "消除", "抹除", "下架", "去除", "移除", "屏蔽", "去掉", "恢复", "处理");
        List<String> group3 = Arrays.asList("企业的", "公司的", "平台上的");
        List<String> group4 = Arrays.asList("负面信息", "失信信息", "行政处罚", "环保处罚", "税务处罚", "消防处罚", "安全生产处罚",
                "工程质量处罚", "交通运输处罚", "工商处罚", "排气污染处罚", "排水污染处罚", "食品药品处罚", "税务违法", "应急处理",
                "立案信息", "开庭公告", "法院公告", "裁判文书", "法律诉讼", "被执行人", "失信被执行人", "限制高消费",
                "工商异常", "欠税公告", "股权冻结", "股权质押", "司法案件", "终本案件", "风险关系", "送达公告",
                "破产重组", "司法拍卖", "诉前调节", "合作风险", "经营异常", "经营风险", "严重违法", "刑事案件",
                "刑事诉讼", "民事诉讼", "民事案件", "劳动纠纷", "劳动仲裁", "动产抵押", "土地抵押", "不动产抵押",
                "黑名单", "严重失信主体", "历史被执行人", "历史行政处罚", "历史环保处罚", "历史法律诉讼", "历史开庭公告",
                "历史立案信息", "历史不良信息", "历史负面信息");

        List<String> combinations = generateCombinations(group1, group2, group3, group4);

        for (String combination : combinations) {
            String encodedText= null;
            try {
                encodedText = URLEncoder.encode(combination, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            System.out.println("https://cn.bing.com/search?q="+encodedText);
//            System.out.println(combination);
        }
    }

    public static List<String> generateCombinations(List<String> group1, List<String> group2,
                                                    List<String> group3, List<String> group4) {
        List<String> combinations = new ArrayList<>();

        for (String item1 : group1) {
            for (String item2 : group2) {
                for (String item3 : group3) {
                    for (String item4 : group4) {
                        String combination = item1 + item2 + item3 + item4;
                        combinations.add(combination);
                    }
                }
            }
        }

        return combinations;
    }
}